//	--------------------------------------------------------------------
//	Copyright(C) 2006,2007 Zhao Yukun. All rights reserved.
//	This file is a part of the Xeres system.
//	Xeres 2007
//	Contact : xeres.engine@gmail.com
//	$(reservedInfo)
//	$(reservedDeclaration)
//	--------------------------------------------------------------------
///	@file	<CBinaryData.h>
///	@path	~/src/database/xdata/
///	@date	2007/11/26
///	@desc	Binary data entry.

#pragma once

#include "xeres.h"

#include "database/IData.h"

namespace xeres {

	/*!
		\class	CBinaryData
		\brief	Binary data entry.
	*/
	class CBinaryData : public IData
	{
	public:

		/// \name Constructor & Destructor
		//@{

		/// \ctor
		CBinaryData( RefWeak<IBuffer> buffer , const WString& name );

		/// \dtor
		virtual ~CBinaryData( void );

		//@}

		DECL_IOBJECT_CLASS( CBinaryData , IData );

	public:

		/// \impl
		virtual const WString& GetVarTypeName( void ) const;

		/// \impl
		virtual const ClassID GetVarTypeID( void ) const;

		/// \impl
		virtual bool GetInfo( DataInfo& datainfo );

		/// \impl
		virtual bool SetObject( RefWeak<IObject> val );

		/// \impl
		virtual bool GetObject( Ref<IObject>& val ) const;
		
		/// \impl
		virtual const Key& GetKey( void ) const;

		/// \impl
		virtual bool Save( void );

		/// \impl
		virtual bool Reload( void );

	private:

		Ref<IBuffer>		m_buffer;
		Key					m_key;
	};

} // namespace xeres
